package nautilus.tank.component;

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class MainFrame extends Frame{
	
	private MapCanvas gameMap = null;
	
	public MainFrame(){
		gameMap = new MapCanvas();
		this.add(gameMap);
		this.pack();
		
		initListeners();
	}
	
	private void initListeners(){
		this.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent we){
				gameMap.stop();
				System.exit(0);
			}
			
			public void windowOpened(WindowEvent we){
				gameMap.setup();
			}
		});
	}
}
